package com.song.tradition.page.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.FavoriteBorder
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.song.tradition.R
import com.song.tradition.ui.theme.customBgColor

@Composable
fun CustomTopAppBar(
    modifier: Modifier = Modifier,
    navClick: () -> Unit,
    actionClick: () -> Unit?={},
) {
    Row(
        modifier = modifier
            .fillMaxWidth()
            .height(56.dp)
            .background(customBgColor)
            .padding(16.dp),
        verticalAlignment = Alignment.CenterVertically
    ) {
        IconButton(
            onClick = { navClick.invoke() },
            modifier = Modifier
                .size(36.dp)
                .clip(CircleShape)
        ) {
            Icon(
                painterResource(id = R.drawable.menu_left_icon),
                contentDescription = "",
                tint = Color.Black,
                modifier = Modifier
                    .height(24.dp)
                    .width(24.dp)
            )
        }
        Spacer(modifier = Modifier.weight(1f))
        IconButton(
            onClick = { actionClick.invoke() },
            modifier = Modifier
                .size(36.dp)
                .clip(CircleShape)
        ) {
            Icon(
                painterResource(id = R.drawable.bell__icon),
                contentDescription = "",
                tint = Color.Black,
                modifier = Modifier
                    .height(24.dp)
                    .width(24.dp)
            )
        }
    }

}


@Composable
fun CustomTitleTopAppBar(
    title: String,
    modifier: Modifier = Modifier,
    navClick: () -> Unit,
    actionClick: () -> Unit?= {  }
    ,
) {
    Row(
        modifier = modifier
            .fillMaxWidth()
            .height(56.dp)
            .background(customBgColor)
            .padding(16.dp),
        verticalAlignment = Alignment.CenterVertically
    ) {
        IconButton(
            onClick = { navClick.invoke() },
            modifier = Modifier
                .size(36.dp)
                .clip(CircleShape)
        ) {
            Icon(
                imageVector = Icons.Default.ArrowBack,
                contentDescription = "",
                tint = Color.Black,
                modifier = Modifier
                    .height(24.dp)
                    .width(24.dp)
            )
        }
        Spacer(modifier = Modifier.width(8.dp))
        Text(text = title, fontSize = 20.sp, fontWeight = FontWeight.Bold)
        Spacer(modifier = Modifier.weight(1f))
        IconButton(
            onClick = {},
            modifier = Modifier
                .size(36.dp)
                .clip(CircleShape)
        ) {
            Icon(
                imageVector = Icons.Default.FavoriteBorder,
                contentDescription = "",
                tint = Color.Black,
                modifier = Modifier
                    .height(24.dp)
                    .width(24.dp)
            )
        }

        Spacer(modifier = Modifier.width(8.dp))
        IconButton(
            onClick = { actionClick.invoke() },
            modifier = Modifier
                .size(36.dp)
                .clip(CircleShape)
        ) {
            Icon(
                painterResource(id = R.drawable.bell__icon),
                contentDescription = "",
                tint = Color.Black,
                modifier = Modifier
                    .height(24.dp)
                    .width(24.dp)
            )
        }
    }

}